package com.designpattern.structure.combination;

/**
 * @author Administration
 * @date 2021/10/19 - 10:55 - 星期二
 * @project 结构型模式中的组合模式   叶子节点（Leaf）
 * @package com.designpattern.structure.combination
 * @by 晨
 */
public class MenuItem extends MenuComponent{
    public MenuItem(String name,int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 1; i < level; i++) {
            System.out.print("--");
        }
        System.out.println(name);
    }
}
